21
Recall the general form of a for
:
for ( initialize ; test ; change ) loopBody ;
The change can be any statement. It can, for example, decrease the control variable, as in this example:
for ( count = 10; count >= 0; --count ) { System.out.println( "count is: " + count ); } System.out.println( "\nDone with the loop.\nCount is now" + count);